package com.xhui.vimarket.zkplus.zul.attr.ada.impl;

import org.zkoss.zk.ui.Component;
import org.zkoss.zul.Button;
import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Datebox;
import org.zkoss.zul.Decimalbox;
import org.zkoss.zul.Div;
import org.zkoss.zul.Doublebox;
import org.zkoss.zul.Intbox;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Timebox;
import org.zkoss.zul.Tree;

import com.xhui.crm.common.util.string.StrUtil;com.xhui.vimarket.zkplusui.vimarket.zkplus.util.Compcom.xhui.vimarket.zkplusrt com.xhui.vimarket.zkplus.zulcom.xhui.vimarket.zkplusda;
import com.xhui.vimarket.zkpcom.xhui.vimarket.zkplusan.AttrTmpl;
import com.xhui.vimarket.zkpcom.xhui.vimarket.zkplusan.impl.AttrTmplImpl;
import com.xhui.vimarketcom.xhui.vimarket.zkplusr.mod.impl.AttrButtonTextComp;
import com.xhui.vimarket.zkplus.zul.textbox.TextboxPlus;

/**
 * 属性适配器-实时方式.
 * 
 * @author wuyx
 * @version Revision 1.0.0
 * 
 */
public class DefaultRtimeAttrAda extends DefaultAttrAda {
    
    /**
     * ins.
     */
    private static AttrAda ins = new DefaultRtimeAttrAda();
    
    /**
     * instance.
     * @return AttrAda
     */
    public static AttrAda instance() {
        return DefaultRtimeAttrAda.ins;
    }
    
    /**
     * 构造函数.
     */
    protected DefaultRtimeAttrAda() {
    }
    
    @Override
    public Component getAttrTmplCompStr(final String displayMode, final AttrTmpl attrTmpl,
        final String sComposer, final String param1, final String param2, Component parentComp) {
        if (AttrTmplImpl.MODE_SELECTLIST.equals(displayMode)) {
            Listbox listbox = new Listbox();
  com.xhui.vimarket.zkplusserUtil.bindComposer(listbox,
                "com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrListboxComposer", parentComp)com.xhui.vimarket.zkplusreturn listbox;
            // return "<listbox apply=\"com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrListboxComposer\" />";
        } else if (AttrTmplImpl.MODE_DATE.equals(displayMode)) {
            Datebox datebox = com.xhui.vimarket.zkplus
            ComposerUtil.bindComposer(datebox,
                "com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrDateCompcom.xhui.vimarket.zkplusmp);
            return datebox;
            // return "<datebox apply=\"com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrDateComposer\" />";
        } else if (AttrTmplImpl.MODE_DATETIME.equals(displayMode)) {
            com.xhui.vimarket.zkplus = new Datebox();
            ComposerUtil.bindComposer(datebox,
                "com.xhui.vimarket.zkplus.zul.attr.evt.com.xhui.vimarket.zkplusomposer", parentComp);
            return datebox;
            // return "<datebox apply=\"com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrDateComposer\" />";
        } else if (AttrTmplImpl.MODE_TEXT.equals(displayMode)) {
  com.xhui.vimarket.zkplusoxPlus textbox = new TextboxPlus();
            ComposerUtil.bindComposer(textbox,
                "com.xhui.vimarket.com.xhui.vimarket.zkplus.evt.rtime.AttrTextComposer", parencom.xhui.vimarket.zkplus      return textbox;
            // return "<textbox use=\"com.xhui.vimarket.zkplus.zul.textbox.TextboxPlus\" apply=\"com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrTextComposer\" />";
        } ecom.xhui.vimarket.zkpluslImpl.MODE_INT.equals(displayMode)) {
            Intbox intbox = new Intbox();
            ComposerUtil.bindComposer(intbox, "com.xhucom.xhui.vimarket.zkplusus.zul.attr.evt.rtime.AttrIntComposer",
                parentComp);
            return intbox;
            // return "<intbox apply=\"com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrIntComposer\" />";
        } else if (AttrTmcom.xhui.vimarket.zkplusBLE.equals(displayMode)) {
            Doublebox doublebox = new Doublebox();
            ComposerUtil.bindComposer(doublebox,com.xhui.vimarket.zkplus   "com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrDoubleComposer", parentComp);
            return doublebox;
            // return "<doublebox apply=\"com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrDoubleComposer\" />";
        } else if (AttrTmplImpl.MODE_MONEY.equals(displayMode)
     com.xhui.vimarket.zkplusmplImpl.MODE_DISCOUNT.equals(displayMode)) {
            Decimalbox inputbox = new Decimalbox();
            ComposerUtil.bincom.xhui.vimarket.zkplusbox,
                "com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrDoubleComposer", parentComp);
            return inputbox;
            // return "<doublebox apply=\"com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrDocom.xhui.vimarket.zkplus/>";
        } else if (AttrTmplImpl.MODE_TIME.equals(displayMode)) {
            Timebox timebox = new Timebox();
    com.xhui.vimarket.zkplusrUtil.bindComposer(timebox,
                "com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrTimeComposer", parentComp);
            return timebox;
            // return "<timebox apply=\"com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrTimeComposer\" />";
        } else if (AttrTmplImpl.MODE_CHcom.xhui.vimarket.zkplusisplayMode)
            || AttrTmplImpl.MODE_CHECKBOX_BYINST.equals(displayMode)) {
            Checkbox checkbox = new Checkbcom.xhui.vimarket.zkplus    ComposerUtil.bindComposer(checkbox,
                "com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrCheckboxComposer", parentComp);
            return checkbox;
            // return "<checkbox apply=\"com.xhui.vimarket.zkcom.xhui.vimarket.zkplusvt.rtime.AttrCheckboxComposer\" />";
        } else if (AttrTmplImpl.MODE_PASSWORD.equals(displayMode)) {
            Textbocom.xhui.vimarket.zkplus Textbox();
            ComposerUtil.bindComposer(textbox,
                "com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrPasswordComposer", parentComp);
            return textbox;
            // return "<textbox apply=\"com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrPasswordComposer\" />";
        } else if (AttrTmplImpl.MODE_BUTTONTEXT.equals(displayMode)) {
            String sDefComposer = AttrButtonTextComp.BTN_DEF_RTIME_COMPOSER;
            if (!this.isSettingPreview() && !"".equals(StrUtil.strnull(sComposer))) {
                // 非预览 并且 有配置情况下采用配置的数据 
                sDefComposer = sComposer;
            }
            Button button = new Button();
            ComposerUtil.bindComposer(button, sDefComposer, parentComp);
            return button;
            // return "<button apply=\"" + sDefComposer + "\" />";
        } else if (AttrTmplImpl.MODE_MENUTEXT.equals(displayMode)) {
            String sDefComposer = AttrButtonTextComp.BTN_DEF_RTIME_COMPOSER;
            if (!this.isSettingPreview() && !"".equals(StrUtil.strnull(sComposer))) {
                // 非预览 并且 有配置情况下采用配置的数据 
                sDefComposer = sComposer;
            }
            Button button = new Button();
            ComposerUtil.bindComposer(button, sDefComposer, parentComp);
        com.xhui.vimarket.zkpluson;
            // return "<button apply=\"" + sDefComposer + "\" />";
        } else if (AttrTmplImpl.MODE_NULLVALcom.xhui.vimarket.zkplusMode)) {
            Div div = new Div();
            ComposerUtil.bindComposer(div,
                "com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrNullValComposer", parentComp);
            return div;
            // return "<divcom.xhui.vimarket.zkplusui.vimarket.zkplus.zul.attr.evt.rtime.AttrNullValComposer\" />";
        } else if (AttrTmplImpl.MODE_SELECTTREE.equals(displayMode)) {
            Tree attrValueTree = new Tree();
            ComposerUtil.bindComposer(attrValueTree,
                "com.xhui.vimarcom.xhui.vimarket.zkplusattr.evt.rtime.AttrTreeComposer", parentComp);
            return attrValueTree;
        } else if (AttrTmplImpl.MODE_MULTISUB.equals(displayMode)) {
            Listbox listbox = new Listbox();
            ComposerUtil.bindComposer(listbox,
                "com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrMultiSubComposer", parentComp);
            return listbox;
        }
        return super.getAttrTmplCompStr(displayMode, attrTmpl, sComposer, param1, param2,
            parentComp);
    }
    
    @Override
    public boolean isCreateNullAttrInst(final String displayMode, final AttrTmpl attrTmpl) {
        return super.isCreateNullAttrInst(displayMode, attrTmpl);
    }
 com.xhui.vimarket.zkpluside
    public Component getAttrPasswordTextbox2Str(String displayMode, AttrTmpl attrTmpl,
        String sComposer, Stcom.xhui.vimarket.zkplusring param2, Component parentComp) {
        Textbox textbox = new Textbox();
        ComposerUtil.bindComposer(textbox,
            "com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrPasswordTwoComposer", parentComp);
        return textbox;
        // return "<textbox apply=\"com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrPasswordTwoComposer\" />";
    }
    
}
